package wiki.hitime.stl.daq.service.factory.impl.check;

import org.springframework.stereotype.Service;
import wiki.hitime.stl.daq.bean.bo.DataAcquisitionValueBO;
import wiki.hitime.stl.daq.bean.bo.DataCheckConfigBO;
import wiki.hitime.stl.daq.bean.bo.DataCheckResultBO;
import wiki.hitime.stl.daq.bean.bo.DataCheckValueBO;
import wiki.hitime.stl.daq.enums.DataAcquisitionTypeEnum;
import wiki.hitime.stl.daq.enums.DataValueTypeEnum;
import wiki.hitime.stl.daq.service.factory.DataCheckFactory;
import wiki.hitime.stl.daq.util.StrUtils;

import java.util.Arrays;

/**
 * @author zhangdaoping
 * @create 2019-07-09 18:56
 */
@Service
public class ForeverTrueCheckImpl implements DataCheckFactory {


    /**
     * 获取实现类暴露的配置信息
     *
     * @return 数据采集类型
     */
    @Override
    public DataCheckConfigBO getCheckConfig() {
        return DataCheckConfigBO.builder()
                .supportAcquisitionType(DataAcquisitionTypeEnum.SINGLE_COLUMN_DATA.getStatus())
                .supportDataValueTypeList(Arrays.asList(
                        DataValueTypeEnum.DATETIME.getStatus(),
                        DataValueTypeEnum.NUMBER.getStatus(),
                        DataValueTypeEnum.BOOLEAN.getStatus(),
                        DataValueTypeEnum.STRING.getStatus()))
                .checkName("始终检查通过")
                .implServiceName(StrUtils.toLowerCase(this.getClass().getSimpleName(), 0))
                .build();
    }

    /**
     * 加载检查结果
     *
     * @param acquisitionValueBO 采集数据对象
     * @param dataCheckValueBO   检查数据对象
     * @return 检查结果对象
     */
    @Override
    public DataCheckResultBO loadCheckResult(DataAcquisitionValueBO acquisitionValueBO, DataCheckValueBO dataCheckValueBO) {
        return DataCheckResultBO.builder()
                .checkResult(Boolean.TRUE)
                .checkSummary("始终检查通过")
                .build();
    }
}
